#ifndef DEFINITION_H
#define DEFINITION_H

#pragma once

#include <DSParaSet.h>

#define GRID_BOUND_NUM_X 10
#define GRID_BOUND_NUM_Y 10

#define ASTAR_PATH_COLOR RGB(255, 193, 37)	//Goldenrod1

typedef enum
{
	DS_CELL_DISPLAY_MODE_INIT = 1000,
	DS_CELL_DISPLAY_MODE_COLOR,
	DS_CELL_DISPLAY_MODE_BMP
}DSCellDisplayType;

typedef struct
{
	float x;
	float y;
	float z;
	float fReserved;
}CDSPoint;

static void InitCDSPoint(CDSPoint *pcdsPoint)
{
	if ( !pcdsPoint ) {
		return;	};

	pcdsPoint->fReserved = 0.0f;
	pcdsPoint->x = 0.0f;
	pcdsPoint->y = 0.0f;
	pcdsPoint->z = 0.0f;
};

typedef struct
{
	CDSPoint LT;
	CDSPoint LB;
	CDSPoint RT;
	CDSPoint RB;
}CDSGrid;

static void InitCDSGrid(CDSGrid *pcdsGrid)
{
	if ( !pcdsGrid ) {
		return; };

	::InitCDSPoint(&pcdsGrid->LB);
	::InitCDSPoint(&pcdsGrid->LT);
	::InitCDSPoint(&pcdsGrid->RB);
	::InitCDSPoint(&pcdsGrid->RT);
};

typedef struct
{
	CDSGrid cdsGridInfo;
	COLORREF clrSelectedColor;			//Color when be selected.
	char szPicFilePath[512];			//Picture File Path for loading Picture file or mapping with Texture Index
	int nCostedAP;						//The length of passed path - g(n)
	int nRequiredAP2Target;				//The length of start point and terminate point - h(n)
	int nTotalCostAP;					//The total length from start point to terminal point - f(n)
	int x;								//Array index of x-direction - 0 based
	int y;								//Array index of y direction - 0 based
	int nDisplayMode;					//Display Mode
	BOOL IsWarkable;
}CDSAStarCell;

static void InitCDSAStarCell(CDSAStarCell *pcdsCell, bool IsSkipCoordinate = false) 
{
//Grid info
	if ( !pcdsCell ) {
		return;	};

	if ( !IsSkipCoordinate ) 
	{
		::InitCDSGrid(&pcdsCell->cdsGridInfo);	
		pcdsCell->x = 0;
		pcdsCell->y = 0;
	}	//End of if ( !IsSkipCoordinate ) 

	pcdsCell->clrSelectedColor = RGB(0, 0, 0);
	pcdsCell->IsWarkable = TRUE;
	pcdsCell->nCostedAP = 0;
	pcdsCell->nRequiredAP2Target = 0;
	pcdsCell->nTotalCostAP = 0;
	pcdsCell->nDisplayMode = DS_CELL_DISPLAY_MODE_COLOR;
	memset(pcdsCell->szPicFilePath, 0, sizeof(pcdsCell->szPicFilePath));
};

typedef struct
{
	DSuint unMouseMovementFlags;
	CPoint ptMousePos;
	HTREEITEM hTreeItem;
	CTreeCtrl * pTree;
}CDSCallBack_LDragOnGLView;

typedef CDSAStarCell CDSAStarWalker;

#endif